<?php

namespace App\Http\Controllers\Api\V1\User;

use App\Models\User\Users;
use App\Models\User\UserAddress;
use Illuminate\Http\Request;
use App\Http\Controllers\Api\V1\BaseController;
use App\Http\Controllers\Api\V1\TransformerController;
use App\Http\Controllers\Api\V1\CustomFommat;

class AddressController extends BaseController
{

    /**
     * 添加地址
     * @param mixed $request
     * @return mixed
     */
    public function add(Request $request)
    {
        return ;
    }

    /**
     * 更新地址
     * @param mixed $request
     * @return mixed
     */
    public function update(Request $request)
    {

        return ;
    }
    /**
     * 获取某条地址
     * @param mixed $request
     * @return mixed
     */
    public function getOne(Request $request)
    {
        $address = UserAddress::find($request->id);
        return $address;
    }
    /**
     * 获取某用户所有地址
     * @param mixed $request
     * @return mixed
     */
    public function getUserAll(Request $request)
    {
        $address = UserAddress::where(['user_id'=>$request->uid])->get();
        return $address;
    }
    /**
     * 删除地址
     * @param mixed $request
     * @return mixed
     */
    public function delOne(Request $request)
    {
        $address = UserAddress::where(['id'=>$request->id])->delete();
        return $address;
    }

}
